# first: wsl install, set local mirror(sed), setss, docker install
# second: docker local mirror accleeration ----aliyun instructions,github test, csdn cites
# third: sudo vim /etc/wsl.conf 
# [boot]
# systemd=true
# and wsl --shutdown and reboot
#
# fourth: docker without sudo ---- to be available in vscode
# fifth: NVIDIA Container Toolkit installation

# note: the skip of errors of "apt update"
#       the activation of conda env
#       the readiness of jupyter and conda env 
FROM nvidia/cuda:11.3.0-cudnn8-devel-ubuntu20.04

MAINTAINER hejiawen

RUN sed -i -r 's#http://(archive|security).ubuntu.com#http://mirrors.ustc.edu.cn#g' /etc/apt/sources.list \
  && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
  && echo 'Asia/Shanghai' >/etc/timezone

RUN apt update ;exit 0
RUN apt install --no-install-recommends -y locales apt-utils binfmt-support qemu-user-static \
     make sudo cpio bzip2 curl wget language-selector-common \
  && apt-get autoremove \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*

RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8

ENV LANG zh_CN.utf8

ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"

RUN wget \
    https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
    && mkdir /root/.conda \
    && bash Miniconda3-latest-Linux-x86_64.sh -b \
    && rm -f Miniconda3-latest-Linux-x86_64.sh 
RUN conda --version \
  && conda install ipykernel \
  && python -m ipykernel install --user --name base --display-name prac

RUN pip install numpy matplotlib \
  && pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
  